#include "Boss.h"

#include "..\Sprite Management\Sprite.h"

#include "..\Message Management\DeleteObjectMessage.h"
#include "..\..\SGD Wrappers\SGD_GraphicsManager.h"

#include "..\Game States\GamePlayState.h"


Boss::Boss()
{
}


Boss::~Boss()
{
	GamePlayState::GetInstance()->SetVictory(true);
}

int Boss::Update(float dt)
{
	// Prevent updates on enemies who are off screen
	if (!IsOnCamera())
		return 0;

	if (GetCurrentHP() <= 0)
	{
		(new DeleteObjectMessage(this))->QueueMessage();
		return 3;
	}

	Enemy::Update(dt);
	return 0;
}

void Boss::HandleCollision(const GameObject* collision)
{
	// Prevent HandlingCollision on enemies who are off screen
	if (!IsOnCamera())
		return;

	// Check if colliding from left side
	SGD::Rectangle currentRect = GetRect();
	SGD::Rectangle collisionRect = collision->GetRect();
	float currentLeft = currentRect.left;
	float currentRight = currentRect.right;
	float currentTop = currentRect.top;
	float currentBottom = currentRect.bottom;
	float collisionLeft = collisionRect.left;
	float collisionRight = collisionRect.right;
	float collisionTop = collisionRect.top;
	float collisionBottom = collisionRect.bottom;
}

void Boss::HandleAttackCollision(const GameObject* collision)
{
	if (!IsInvulnerable())
	{
		GetEmitters()[0]->SetPlay(true);
		SetParticleTimer(0.75f);
		Entity::HandleAttackCollision(collision);
	}
}